package cn.bossfriday.im.common.message.api.enties;

import lombok.*;

import java.net.InetSocketAddress;

/**
 * AccessServerAddress
 *
 * @author chenx
 */
@ToString
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AccessServerAddress {

    private String address;

    private int protocol;

    /**
     * toInetSocketAddress
     *
     * @return
     */
    public InetSocketAddress toInetSocketAddress() {
        String[] tmp = this.address.split(":");

        return new InetSocketAddress(tmp[0], Integer.parseInt(tmp[1]));
    }
}
